import Vue from 'vue'
import App from './App.vue'
import router from './router'

/************引入axios****************/
//导入axios组件
import axios from 'axios'
//创建axios实例对象，并进行通用配置
var axiosInstance = axios.create({
    //设置axios进行ajax请求的基础路径
    baseURL: 'http://localhost:3000/',
    //设置请求头，指定请求为ajax请求
    headers: {'X-Requested-With': 'XMLHttpRequest'}
});
//将axios设置为Vue的原型属性
Vue.prototype.$axios = axiosInstance;
/***********************************/

/**************引入ElementUI组件*****************/
//导入ElementUI组件
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);//设置在Vue中使用ElementUI
/****************************************/

Vue.config.productionTip = false
// 全局方法
Vue.prototype.backToProvider = function () {
    //this.$router.push('providerManager')
    location.hash = '#/providerManager'
}

Vue.prototype.backToUser = function () {
    location.hash = '#/userManager';
}
Vue.prototype.logout = function (){
    window.localStorage.removeItem('token')
    location.hash = '#/login';

}
new Vue({
    router,
    render: h => h(App)
}).$mount('#app')
